package com.hwx.feign;

import com.hwx.pojo.Member;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 服务降级  处理类
 */
@Component
public class IMemberFeignFalbackFactory implements FallbackFactory<IMemberFeign> {

    @Override
    public IMemberFeign create(Throwable cause) {
        return new IMemberFeign() {
            @Override
            public String getMemberById(Integer id) {
                return "当前人数太多请稍后查看！";
            }

            @Override
            public void addMember(Member member) {

            }

            @Override
            public List<Member> getMemberList() {
                return null;
            }

            @Override
            public Member getMemberById2(Integer id) {
                return new Member(-1,"当前系统嫖娼去了，稍等再来！");
            }
        };
    }
}
